import koa from 'koa'
import 'reflect-metadata'
// import body from 'koa-body'
// import json from 'koa-json'
// import Router from 'koa-router'
// import userRouter from './router/user'
// import allRouterLoader from './common/AllRouterLoader'
// import dbconfig from './conf/dbconfig'

import { allCtrlRouterLoader } from './common/AllCtrlRouterLoader'
import { appInstance } from './common/AppInstance'

// console.log('dbconfig database', dbconfig.getConf('database'))
// console.log('dbconfig', dbconfig.getConf())

const app = new koa()

// allRouterLoader.init(app)
appInstance.init(app)
allCtrlRouterLoader.init(app)

// const router = new Router()
// router.prefix('/dang') //为所有路由访问添加路由前缀/dang，作为一级路由
// router.use(json())
// router.use(body())

// router.get('/test', async (ctx: koa.Context) => {
//   ctx.body = '第一个测试页面!!!!'
// })

// router.use(userRouter.routes(), userRouter.allowedMethods())

//加载路由到全局路由上
// app.use(router.routes())
// app.use(router.allowedMethods())
// app.listen(3002)

// console.log('server is running on port 3002')
